//
//  Helper.h
//  Stuin
//
//  Created by Jingjing Huang on 15/1/4.
//  Copyright (c) 2015年 宁波心恒思途信息科技有限公司. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CoreDataManager.h"
@interface Helper : NSObject

//到现在为止，过去了多长时间 比如 1分钟前，2小时前，3天前，1个月前等等
+(NSString *)getDatePassedFromDateString:(NSString *)dateString;
+(NSString *)getDatePassedFromDate:(NSDate *)date;
//从时间字符串取出日期部分
+(NSDate *)getDateFromDateString:(NSString *)dateString;
+(NSDate *)getDateFromDateString:(NSString *)dateString dateFormat:(NSString *)dateFormat;
+(NSString *)getStandardDateString:(NSString *)dateString dateFormat:(NSString *)dateFormat;

//计算文本的高度，返回的矩形框
+(CGRect)getSizeWithString:(NSString *)string fontSize:(int)fontSize width:(int)width;
//计算2个坐标之间的距离，返回字符串
+ (NSString *)getDistance:(float)fromLat fromLon:(float)fromLon toLat:(float)toLat toLon:(float)toLon;
//计算2个坐标之间的距离，返回浮点小数点
+ (float)getDistances:(float)fromLat fromLon:(float)fromLon toLat:(float)toLat toLon:(float)toLon;
//把字典转换成json字符串
+(NSString *)getJsonStringFromDictionary:(NSDictionary *)dict;
//把字典存入本地plist文件里面
+(void)WriteDatatoList:(NSDictionary *)dic toFileName:(NSString *)FileName;
//从本地plist文件里面取出字典
+(NSDictionary *)LoadDataFromList:(NSString *)FileName;
//返回appdelegate的coredata的上下文
+(NSManagedObjectContext *)managedObjectContext;
//保存coredata数据更新
+(void)saveContext;
//异步下载文件
+ (void)downloadFileWithURL:(NSURL *)url completionBlock:(void (^)(BOOL succeeded, NSData *data))completionBlock;
//获取小图
+(NSString *)getSmallImagePath:(NSString *)path;
//根据Storyboard获取ViewController
+(UIViewController *)getViewController:(NSString *)viewController withStoryboard:(NSString *)storyBoard;

@end
